caffeinalab / ti.goosh

GCM/FCM module for Titanium.
MIT License
52 stars 34 forks source link

Appc android issue 2373 - assistance would be appreciated #63

Closed Lenndev closed 7 years ago

Lenndev commented 7 years ago

Hi, all!

Just implemented your nice and easy plugin (v 1.6.2, since i need to build on ti sdk 5.5.1) If the app is in foreground, it all works fine, even if the app is in background (not closed completely) i receive the push notification (although the badge is not shown), but onclick my app crashes and i get the following error:

[ERROR] :  TiLaunchActivity: (main) [142877,142877] Android issue 2373 detected (missing intent CATEGORY_LAUNCHER or FLAG_ACTIVITY_RESET_TASK_IF_NEEDED), restarting app. net.myapp.app.MyAppActivity@1686701
[ERROR] :  AndroidRuntime: FATAL EXCEPTION: main
[ERROR] :  AndroidRuntime: Process: net.autotaxatie.app, PID: 6465
[ERROR] :  AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{net.myapp.app/net.myapp.app.MyAppActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.ViewGroup.getPaddingLeft()' on a null object reference
[ERROR] :  AndroidRuntime:  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3255)
[ERROR] :  AndroidRuntime:  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3351)
[ERROR] :  AndroidRuntime:  at android.app.ActivityThread.access$1100(ActivityThread.java:222)
[ERROR] :  AndroidRuntime:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1796)
[ERROR] :  AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:102)
[ERROR] :  AndroidRuntime:  at android.os.Looper.loop(Looper.java:158)
[ERROR] :  AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:7230)
[ERROR] :  AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method)
[ERROR] :  AndroidRuntime:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
[ERROR] :  AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
[ERROR] :  AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.ViewGroup.getPaddingLeft()' on a null object reference
[ERROR] :  AndroidRuntime:  at android.support.v7.app.AppCompatDelegateImplV7.applyFixedSizeWindow(AppCompatDelegateImplV7.java:487)
[ERROR] :  AndroidRuntime:  at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:287)
[ERROR] :  AndroidRuntime:  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:244)
[ERROR] :  AndroidRuntime:  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:114)
[ERROR] :  AndroidRuntime:  at org.appcelerator.titanium.TiBaseActivity.setContentView(TiBaseActivity.java:567)
[ERROR] :  AndroidRuntime:  at org.appcelerator.titanium.TiLaunchActivity.checkInvalidLaunch(TiLaunchActivity.java:192)
[ERROR] :  AndroidRuntime:  at org.appcelerator.titanium.TiLaunchActivity.checkInvalidLaunch(TiLaunchActivity.java:162)
[ERROR] :  AndroidRuntime:  at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:78)
[ERROR] :  AndroidRuntime:  at android.app.Activity.performCreate(Activity.java:6877)
[ERROR] :  AndroidRuntime:  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
[ERROR] :  AndroidRuntime:  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3208)
[ERROR] :  AndroidRuntime:  ... 9 more
after some searching i added the next property to my tiapp.xml, but it doesn't do a thing.

<property name="ti.android.bug2373.finishfalseroot" type="bool">true</property>

So i am wondering if anyone of you can assist me in resolving this "issue" i have.

testing on Samsung galaxy J7. Ti SDK 5.5.1 , ti.goosh v 1.6.2

progress44 commented 7 years ago

The latest version should work the same with titanium sdk 5.5.1

Lenndev commented 7 years ago

Really? cause i thought its minium ti sdk was set on ti sdk 6.x.x

progress44 commented 7 years ago

How have you implemented the module?

Lenndev commented 7 years ago

i downloaded the zip, unpacked it and put it in modules folder, then added it to tiapp (if i remember correctly)

progress44 commented 7 years ago

Can you paste your tiapp.xml here? Also make sure to be using the right google-play-services jar for your project https://github.com/caffeinalab/ti.goosh/tree/master/gps-jars

Lenndev commented 7 years ago
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
    <id>net.app.my</id>
    <name>myApp</name>
    <version>2.4</version>
    <publisher>My Company</publisher>
    <url>http://www.myapp.com/</url>
    <description>undefined</description>
    <copyright>2016 by Fresh Apple</copyright>
    <icon>appicon.png</icon>
    <fullscreen>false</fullscreen>
    <navbar-hidden>false</navbar-hidden>
    <analytics>false</analytics>
    <!-- WARNING: Please note the owner of the GUID when adding a new one or commenting one out.  -->

    <guid>xxx-xxxx-xxxx-xxxxx</guid>
    <property name="gcm.senderid" type="string">xxxxxxx</property>
    <ios>
        <enable-launch-screen-storyboard>true</enable-launch-screen-storyboard>
        <plist>
            <dict>
                <key>UISupportedInterfaceOrientations~iphone</key>
                <array>
                    <string>UIInterfaceOrientationPortrait</string>
                </array>
                <key>UISupportedInterfaceOrientations~ipad</key>
                <array>
                    <string>UIInterfaceOrientationPortrait</string>
                </array>
                <key>UIRequiresPersistentWiFi</key>
                <false/>
                <key>UIPrerenderedIcon</key>
                <false/>
                <key>UIStatusBarHidden</key>
                <false/>
                <key>UIStatusBarStyle</key>
                <string>UIStatusBarStyleDefault</string>
                <key>NSPhotoLibraryUsageDescription</key>
                <string>my App requiese access to the gallery
                </string>
                <key>NSCameraUsageDescription</key>
                <string>My app needs acces to the camera
                </string>
            </dict>
        </plist>
    </ios>
    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest android:installLocation="preferExternal"
                  android:versionCode="1" android:versionName="1.0.0" package="net.myApp.app">
            <supports-screens android:anyDensity="true"
                              android:largeScreens="true" android:normalScreens="true"
                              android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true"/>
            <application android:theme="@style/myAppTheme">
                <meta-data android:name="com.google.android.gms.version"
                           android:value="@integer/google_play_services_version"/>

                <activity android:alwaysRetainTaskState="true"
                          android:configChanges="keyboardHidden|screenSize"
                          android:label="@string/app_name"
                          android:launchMode="singleTask"
                          android:name=".ATPActivity"
                          android:screenOrientation="portrait" android:windowSoftInputMode="adjustResize">
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN"/>
                        <category android:name="android.intent.category.LAUNCHER"/>
                    </intent-filter>
                </activity>

            </application>
            <property name="ti.ui.defaultunit" type="string">dp</property>
            <property name="ti.android.bug2373.finishfalseroot" type="bool">true</property>

            <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="23"/>
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
            <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
            <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
            <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
            <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
            <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
            <uses-permission android:name="android.permission.CAMERA"/>
            <uses-permission android:name="android.permission.INTERNET"/>
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
            <!-- new !-->
            <supports-screens android:anyDensity="true"
                              android:largeScreens="true" android:normalScreens="true"
                              android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true"/>
            <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
            <uses-feature android:name="android.hardware.camera" android:required="false"/>
            <uses-feature
                    android:name="android.hardware.camera.autofocus" android:required="false"/>
            <uses-feature android:name="android.hardware.sensor" android:required="false"/>
            <uses-feature
                    android:name="android.hardware.sensor.accelerometer" android:required="false"/>
            <uses-feature
                    android:name="android.hardware.sensor.proximity" android:required="false"/>
            <uses-feature android:name="android.hardware.sensor.compass" android:required="false"/>
            <uses-feature android:name="android.hardware.sensor.light" android:required="false"/>
            <uses-feature
                    android:name="android.hardware.location.network" android:required="false"/>
            <uses-feature android:name="android.hardware.wifi" android:required="false"/>
            <uses-feature android:name="android.hardware.bluetooth" android:required="true"/>
            <uses-feature android:name="android.hardware.location.gps" android:required="true"/>
            <!-- new !-->
        </manifest>
    </android>
    <mobileweb>
        <precache/>
        <splash>
            <enabled>true</enabled>
            <inline-css-images>true</inline-css-images>
        </splash>
        <theme>default</theme>
    </mobileweb>
    <modules>
        <module platform="commonjs">ti.cloud</module>
        <module platform="iphone" version="1.12">com.behindmedia.medialibrarypicker</module>
        <module platform="iphone">ti.imagefactory</module>
        <module platform="android">com.rkam.swiperefreshlayout</module>
        <module platform="android">ti.mediapicker</module>
        <module platform="android">de.marcelpociot.autofocus</module>
        <module platform="android">com.alcoapps.imageutility</module>
        <module platform="android">fh.imagefactory</module>
        <module platform="android" version="1.6.2">ti.goosh</module>
    </modules>
    <deployment-targets>
        <target device="android">true</target>
        <target device="ipad">true</target>
        <target device="iphone">true</target>
        <target device="mobileweb">false</target>
        <target device="windows">false</target>
    </deployment-targets>
    <sdk-version>5.5.1.GA</sdk-version>
    <plugins>
        <plugin version="1.0">ti.alloy</plugin>
    </plugins>
    <property name="ti.ui.defaultunit" type="string">dp</property>
    <property name="appc-app-id" type="string">xxxxx</property>
    <property name="acs-authbase-url-development" type="string">https://secure-identity.cloud.appcelerator.com
    </property>
    <property name="acs-base-url-development" type="string">https://api.cloud.appcelerator.com</property>
    <property name="acs-oauth-secret-development" type="string">xxxxx</property>
    <property name="acs-oauth-key-development" type="string">xxxx</property>
    <property name="acs-api-key-development" type="string">xxxx</property>
    <property name="acs-username-development" type="string">appc_app_user_dev</property>
    <property name="acs-password-development" type="string">xxx</property>
    <property name="acs-authbase-url-production" type="string">https://secure-identity.cloud.appcelerator.com</property>
    <property name="acs-base-url-production" type="string">https://api.cloud.appcelerator.com</property>
    <property name="acs-oauth-secret-production" type="string">xxxx</property>
    <property name="acs-oauth-key-production" type="string">xxxx</property>
    <property name="acs-api-key-production" type="string">mdIxvxh20RbKssXP8a6THVkDZRoPdses</property>
    <property name="acs-username-production" type="string">appc_app_user</property>
    <property name="acs-password-production" type="string">xxx</property>
    <property name="appc-org-id" type="string">xxxx</property>
    <property name="appc-creator-user-id" type="string"xxxxxx/property>
    <property name="run-on-main-thread" type="bool">true</property>
</ti:app>

hi sorry for the delayed response, here is my tiapp.xml About the google play services i followed the instructions on

https://medium.com/all-titanium/deal-with-titanium-modules-and-its-missing-support-for-android-multidex-546de5486d13#.wfo7v4akx.

but maybe i made a mistake in that...

in the lib folder of version 1.6.2 there is a google-play-services-tigoosh.jar ... it wasnt clear to me if i need to use this one or manipulate it or do anything with it...

extra info would be nice... And i'll retry to use the latest version, but for 80% i am sure it needs ti SDK 6.x.x

Lenndev commented 7 years ago

to be clear... i can receive push notifications when app is in foreground.. and i do receive them if the app is in background, but then the app crashes on opening with this error

progress44 commented 7 years ago

As I thought, it seems like your issue is within the app and not the module. Your app id doesn't match package name

<id>net.app.my</id>
<manifest android:installLocation="preferExternal"
                 android:versionCode="1" android:versionName="1.0.0" package="net.myApp.app">

This isn't a module issue. Please submit issues only relative to the module please.