Libgdx - IllegalStateException at unknown location - java

I am using android studio 1.3, and libgdx 1.6.2 to create a game. I want to incorporate google play services to my game and I have completed everything in one step, because I did it before without problem. However, this time it gave me an exception:
java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
at com.google.android.gms.common.internal.zzi$zza.zzc(Unknown Source)
at com.google.android.gms.common.internal.zzi$zza.zzr(Unknown Source)
at com.google.android.gms.common.internal.zzi$zzc.zznQ(Unknown Source)
at com.google.android.gms.common.internal.zzi$zzb.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
So here is what I changed other than adding baseGameUtils (which was sucessfully added).
EDIT:
The Full Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bearfishapps.cells.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/GdxTheme" >
<activity
android:name="com.example.app.android.AndroidLauncher"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.purplebrain.adbuddiz.sdk.AdBuddizActivity"
android:theme="#android:style/Theme.Translucent" />
</application>
</manifest>
And here is my android main activity.
public class AndroidLauncher extends AndroidApplication implements GameHelper.GameHelperListener{
private GameHelper gameHelper;
#Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (gameHelper == null) {
gameHelper = new GameHelper(this, GameHelper.CLIENT_GAMES);
}
gameHelper.setup(this);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
initialize(new Cells(new ActionResolver() {
#Override
public boolean getSignedInGPGS() {
return gameHelper.isSignedIn();
}
#Override
public void loginGPGS() {
try {
runOnUiThread(new Runnable() {
public void run() {
gameHelper.beginUserInitiatedSignIn();
}
});
} catch (final Exception ex) {
}
}
#Override
public void submitScoreGPGS(int score) {
Games.Leaderboards.submitScore(gameHelper.getApiClient(), "CgkI6ZHYr9IEEAIQBg", score);
}
#Override
public void getLeaderboardGPGS() {
if (gameHelper.isSignedIn()) {
startActivityForResult(Games.Leaderboards.getLeaderboardIntent(gameHelper.getApiClient(), "CgkI6ZHYr9IEEAIQBg "), 100);
}
else if (!gameHelper.isConnecting()) {
loginGPGS();
}
}
#Override
public void unlockAchievementGPGS(String achievementId) {
Games.Achievements.unlock(gameHelper.getApiClient(), achievementId);
}
#Override
public void getAchievementsGPGS() {
if (gameHelper.isSignedIn()) {
startActivityForResult(Games.Achievements.getAchievementsIntent(gameHelper.getApiClient()), 101);
}
else if (!gameHelper.isConnecting()) {
loginGPGS();
}
}
}), config);
}
#Override
public void onStart(){
super.onStart();
gameHelper.onStart(this);
}
#Override
public void onStop(){
super.onStop();
gameHelper.onStop();
}
#Override
public void onActivityResult(int request, int response, Intent data) {
super.onActivityResult(request, response, data);
gameHelper.onActivityResult(request, response, data);
}
#Override
public void onSignInFailed() {
}
#Override
public void onSignInSucceeded() {
}
}
I can't tell whats wrong here.
Thanks in advance.

You need to use <meta-data> inside your <application> tag in the AndroidManifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bearfishapps.cells.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/GdxTheme" >
<activity
android:name="com.example.app.android.AndroidLauncher"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.purplebrain.adbuddiz.sdk.AdBuddizActivity"
android:theme="#android:style/Theme.Translucent" />
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
Clear your data and uninstall updates on Google Play Services.
Then, reinstall it.

Related

What does 'No file known for: classes2.dex' mean?

I built an app and I have different classes, and first I got an error like this when I tried to run the app
Cannot fit requested classes in a single dex file (# methods: 66087 > 65536)
I followed some instructions from Google and I added to my build.gradle
this dependency
implementation 'com.android.support:multidex:1.0.3'
and to the defaultConfig this
multiDexEnabled true
In my manifest xml I added this
android:name="android.support.multidex.MultiDexApplication"
but its highlighted with red color and when I move the cursor over it says
Unresolved class MultiDexApplication
When I try to run the app again it throws me
No file known for: classes2.dex
Known maps: {RelativeFile{base=/Users/***/AndroidStudioProjects/****/app/build/intermediates/dex/debug/mergeDexDebug/out/classes.dex, path=classes.dex, type=DIRECTORY}=classes.dex, RelativeFile{base=/Users/****/AndroidStudioProjects/****/app/build/intermediates/dex/debug/mergeProjectDexDebug/out/classes.dex, path=classes.dex, type=DIRECTORY}=classes3.dex, RelativeFile{base=/Users/*****/AndroidStudioProjects/****/app/build/intermediates/dex/debug/mergeExtDexDebug/out/classes2.dex, path=classes2.dex, type=DIRECTORY}=classes4.dex}
This is the MainActivity Class
package com.example.drivieapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Intent i = new Intent(this, screenNotLogged.class );
Thread timer = new Thread() {
public void run() {
try {
sleep(3100);
}
catch(InterruptedException e) {
e.printStackTrace();
}
finally {
startActivity(i);
finish();
}
}
};
timer.start();
}
}
Can you please explain me what I have to do? I google the solution but didn't understand too much. Thank you very much!
Manifest xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="****">
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="Drivie"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:name="android.support.multidex.MultiDexApplication"
>
<activity android:name=".SignupCarrier"></activity>
<activity android:name=".carrierSignupHint" />
<activity android:name=".home" />
<activity android:name=".SignupSender" />
<activity android:name=".signup" />
<activity android:name=".screenNotLogged" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Custom PrintService in Android not showing up in the list of printers

I am attempting to create a custom PrintService plugin for Android, and I have everything except for that it is not showing up in the list of printers under 'All Printers', and says 'Cannot add printers' under my print service if I click "Add printer" manually. I downloaded this print service which does show up in the list of printers, but I can't figure out what is different in their code versus mine.
My PrintService class:
public class MyPrintService extends PrintService {
PrinterInfo mThermalPrinter;
#Override
public void onCreate() {
mThermalPrinter = new PrinterInfo.Builder(generatePrinterId("USB"),
"USB Printer", PrinterInfo.STATUS_IDLE).build();
}
#Override
protected void onPrintJobQueued(PrintJob printJob) {
Intent intent = new Intent(MyPrintService.this, MainActivity.class);
intent.putExtra("data", printJob.getDocument().getData());
printJob.start();
startActivity(intent);
}
#Nullable
#Override
protected PrinterDiscoverySession onCreatePrinterDiscoverySession() {
return new ThermalPrinterDiscoverySession(mThermalPrinter);
}
#Override
protected void onRequestCancelPrintJob(PrintJob printJob) {
printJob.cancel();
}
}
class ThermalPrinterDiscoverySession extends PrinterDiscoverySession {
private PrinterInfo printerInfo;
ThermalPrinterDiscoverySession(PrinterInfo printerInfo) {
PrinterCapabilitiesInfo capabilities =
new PrinterCapabilitiesInfo.Builder(printerInfo.getId())
.addMediaSize(PrintAttributes.MediaSize.ISO_A5, true)
.addResolution(new PrintAttributes.Resolution("1234","Default",200,200), true)
.setColorModes(PrintAttributes.COLOR_MODE_MONOCHROME, PrintAttributes.COLOR_MODE_MONOCHROME)
.build();
this.printerInfo = new PrinterInfo.Builder(printerInfo)
.setCapabilities(capabilities)
.build();
}
#Override
public void onStartPrinterDiscovery(List<PrinterId> priorityList) {
List<PrinterInfo> printers = new ArrayList<PrinterInfo>();
printers.add(printerInfo);
addPrinters(printers);
}
#Override
public void onStopPrinterDiscovery() {
}
#Override
public void onValidatePrinters(List<PrinterId> printerIds) {
}
#Override
public void onStartPrinterStateTracking(PrinterId printerId) {
}
#Override
public void onStopPrinterStateTracking(PrinterId printerId) {
}
#Override
public void onDestroy() {
}
}
Thanks!
Turns out that it was an issue with the AndroidManifest.xml.
The manifest needs to be as follows:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dubtel.print_service">
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
r
<service
android:name=".MyPrintService"
android:permission="android.permission.BIND_PRINT_SERVICE">
<intent-filter>
<action android:name="android.printservice.PrintService" />
</intent-filter>
<meta-data
android:name="android.printservice"
android:resource="#xml/printservice" />
</service>
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information.
-->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>

App crashes on resuming by clicking the app icon from menu

App launches normally. When I try to minimize it and reopen through the recent apps history, again it works fine. But when I minimize and try to re open it with the app icon, it crashes.
MainActivity.java
public class MainActivity extends AppCompatActivity implements ResetPasswordDialog.Listener {
public static final String TAG = MainActivity.class.getSimpleName();
private LoginFragment mLoginFragment;
private ResetPasswordDialog mResetPasswordDialog;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
loadFragment();
}
}
private void loadFragment(){
if (mLoginFragment == null) {
mLoginFragment = new LoginFragment();
}
getFragmentManager().beginTransaction().replace(R.id.fragmentFrame,mLoginFragment,LoginFragment.TAG).commit();
}
#Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
String data = intent.getData().getLastPathSegment();
Log.d(TAG, "onNewIntent: "+data);
mResetPasswordDialog = (ResetPasswordDialog) getFragmentManager().findFragmentByTag(ResetPasswordDialog.TAG);
if (mResetPasswordDialog != null)
mResetPasswordDialog.setToken(data);
}
#Override
public void onPasswordReset(String message) {
showSnackBarMessage(message);
}
private void showSnackBarMessage(String message) {
Snackbar.make(findViewById(R.id.activity_main),message, Snackbar.LENGTH_SHORT).show();
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-feature
android:name="android.hardware.camera.front"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<!--singleTask => flag of launchMode -->
<application
android:name="io.github.froger.xinger.InstaMaterialApplication"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name="io.github.froger.xinger.ui.activity.MainActivity"
android:launchMode="singleTop"
android:theme="#style/AppTheme.LoginRegister"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="learn2crack"
android:scheme="http" />
</intent-filter>
</activity>
<activity
android:name="io.github.froger.xinger.ui.activity.DashboardActivity"
android:screenOrientation="portrait">
</activity>
<activity
android:name="io.github.froger.xinger.ui.activity.CommentsActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.TransparentActivity" />
<activity
android:name="io.github.froger.xinger.ui.activity.UserProfileActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.TransparentActivity"
android:launchMode="singleInstance" />
<activity
android:name="io.github.froger.xinger.ui.activity.TakePhotoActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.TransparentActivity" />
<activity
android:name="io.github.froger.xinger.ui.activity.PublishActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme"
android:windowSoftInputMode="stateHidden">
</activity>
</application>
Error
04-01 00:51:26.015 25525-25525/io.github.froger.instamaterial D/AndroidRuntime: Shutting down VM
04-01 00:51:26.016 25525-25525/io.github.froger.instamaterial E/AndroidRuntime: FATAL EXCEPTION: main
Process: io.github.froger.instamaterial, PID: 25525
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getLastPathSegment()' on a null object reference
at io.github.froger.xinger.ui.activity.MainActivity.onNewIntent(MainActivity.java:44)
at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1245)
at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1257)
at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:2804)
at android.app.ActivityThread.performNewIntents(ActivityThread.java:2816)
at android.app.ActivityThread.handleNewIntent(ActivityThread.java:2825)
at android.app.ActivityThread.-wrap15(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1552)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
The stack trace clearly indicates that the call to intent.getData() at line 44 of your MainActivity is returning a null. You should check for the null, and not try to interrogate the Intent if it is null.
You could store string data in a static variable, and then check to see if it's null. If it's null use the static data. I know static variables are frowned upon and you should address the root problem, but this will fix your immediate problem.
static String yourStaticString;
...
String data;
if (intent.getData()==NULL)
{
data = yourStaticString;
}
else
{
if (intent.getData().getLastPathSegment()!=NULL)
{
data = intent.getData().getLastPathSegment();
yourStaticString = data;
} else return;
}

Running code on boot android

I'm having issues getting code to run on boot, I've downloaded the source for an example that should work, but it doesn't. according to the example, it should produce a toast when the phones turned on, but it doesn't happen, I've tested on android 6.0 and 7.0.
any help is appreciated thanks.
The code is as follows:
Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androidautostartup"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" >
</uses-permission>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<receiver
android:name=".BootComplete"
android:enabled="true"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:name=".AutoStartUp" >
</service>
<activity
android:name="com.example.androidautostartup.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
BootComplete.java
public class BootComplete extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equalsIgnoreCase(Intent.ACTION_BOOT_COMPLETED)) {
Intent serviceIntent = new Intent(context, AutoStartUp.class);
context.startService(serviceIntent);
}
}
}
AutoStartUp.java
public class AutoStartUp extends Service {
#Override
public IBinder onBind(Intent intent) {
return null;
}
#Override
public void onCreate() {
super.onCreate();
Toast.makeText(this, "Service Started", Toast.LENGTH_LONG).show();
// do something when the service is created
}
}
I really wouldn't recommend doing UI stuff on a worker thread (service). While it can be done, it generates confusion for the user to receive a message outside an app context.
Having said that, if you need to do this you should be running UI code on the UI thread.
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
#Override
public void run() {
Toast.makeText(getContext(), "Service Started", Toast.LENGTH_LONG).show();
}
});

NoClassFound com.google.android.gms.gcm.GcmReceiver on Nexus 5->Android 5.1.1

I am trying to modify and implement GCM (hmkode) in eclipse.I have imported project in eclipse and performed the necessary steps for setup.
http://hmkcode.com/android-google-cloud-messaging-tutorial/
After going through GCM sample on developer.google.com .The link says google includes GcmReceiver class by default.I removed old GcmBroadcastReceiver from hmkode sample and changed GcmMessageHandler to extend GcmListenerService instead of IntentService(in hmkode/original code).
Link:
https://developers.google.com/cloud-messaging/android/client
Problem:
When I try to send message to the client the client crashes with following exception in logcat
E/AndroidRuntime(20573): java.lang.RuntimeException: Unable to instantiate receiver com.google.android.gms.gcm.GcmReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.gcm.GcmReceiver" on path: DexPathList[[zip file "/data/app/com.hmkcode.android.gcm-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
E/AndroidRuntime(20573):
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2590)
My Class structure-
public class GcmMessageHandler extends GcmListenerService {
String mes;
private Handler handler;
public GcmMessageHandler() {
super();
}
//com.hmkcode.android.gcm.
#Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
handler = new Handler();
}
public void showToast(){
handler.post(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(),mes , Toast.LENGTH_LONG).show();
}
});
}
}
Activity class
public class MainActivity extends Activity implements OnClickListener {
Button btnRegId;
EditText etRegId;
GoogleCloudMessaging gcm;
String regid;
String PROJECT_NUMBER = "164502923904";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnRegId = (Button) findViewById(R.id.btnGetRegId);
etRegId = (EditText) findViewById(R.id.etRegId);
btnRegId.setOnClickListener(this);
}
public void getRegId(){
new AsyncTask<Void, Void, String>() {
#Override
protected String doInBackground(Void... params) {
String msg = "";
try {
if (gcm == null) {
gcm = GoogleCloudMessaging.getInstance(getApplicationContext());
}
regid = gcm.register(PROJECT_NUMBER);
msg = "Device registered, registration ID=" + regid;
Log.i("GCM", msg);
} catch (IOException ex)
{
msg = "Error :" + ex.getMessage();
}
return msg;
}
#Override
protected void onPostExecute(String msg) {
etRegId.setText(msg + "\n");
}
}.execute(null, null, null);
}
#Override
public void onClick(View v) {
getRegId();
}
}
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hmkcode.android.gcm"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<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.hmkcode.android.gcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.hmkcode.android.gcm.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
>
<activity
android:name="com.hmkcode.android.gcm.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.hmkcode.android.gcm" />
</intent-filter>
</receiver>
<service android:name="com.hmkcode.android.gcm.GcmMessageHandler" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
Also gcm.jar has been added as dependency and exported.
If you use Eclipse with regular android gcm jar, u need to add com.google.android.gcm.GcmReceiver instead of com.google.android.gcm.GCMBroadcastReceiver. This worked for me (at least temporarily)

Categories

Resources