I have an app that runs perfectly on some phones (All samsung Galaxys, some
LGs) and fails on an HTC ONE X, and an LG G2.
The app has a MainActivity, a Flashlight activity, a broadcast receiver,
and an intent service. The app can run in two different modes.
Mode 1: The user clicks on the icon and the mainactivity runs - when this
happens, the MainActivity immediately runs the Flashlight activity and
calls finish. The app functions as a flashlight program.
Mode 2: The broadcast receiver receives a Google Cloud Message and runs the
intent service which loads up an extra bundle and runs MainActivity.
MainActivity detects the extra and does NOT run FlashLight but instead
does some other work.
The problem is with Mode 2 on an HTC ONE X or LG G2, when the intent
service runs MainActivity, the onStart event is triggered in the FlashLight
activity showing the flashlight screen. As expected, MainActivity
functions perfectly - the problem is just that the FlashLight screen shows.
This is the code the intent service uses to start MainActivity...
Intent intentHome = new Intent(GlobalStuff.GCT,MainActivity.class);
intentHome.putExtra("whattodo", "presence");
intentHome.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
GlobalStuff.GCT.startActivity(intentHome); //GlobalStuff.GCT is app context
This is the app manifest file...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.deanblakely.Target"
android:versionCode="4"
android:versionName="1.4" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- following permissions for GCM -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission
android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.deanblakely.Target.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission
android:name="com.deanblakely.Target.permission.C2D_MESSAGE" />
<uses-feature android:name="android.hardware.camera" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<activity
android:name="com.deanblakely.Target.MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoDisplay"
android:excludeFromRecents="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<receiver
android:name=".GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action
android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.deanblakely.Target" />
</intent-filter>
</receiver>
<service android:name=".GcmIntentService" />
<activity
android:name="com.deanblakely.Target.FlashLight"
android:screenOrientation="portrait"
android:label="@string/title_activity_flash_light" >
</activity>
<activity
android:name="com.deanblakely.Target.Tell"
android:label="@string/title_activity_tell"
android:theme="@android:style/Theme.NoDisplay" >
</activity>
<uses-library android:name="com.google.android.maps" />
<service
android:name="com.deanblakely.Target.StalkService"
android:exported="false"/>
</application>
</manifest>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.