I have 1 android app project and 1 widget project, they all work fine. Now, i want to include widget project to android app project in order to when user install application, the widget will be installed too. I did like below but it did not work. Any helps?
Thanks you!
In manifest file:
<application>
............ (this is of android app project. below is of widget).......
<receiver android:name=".widget.PlayerWidgetActivity" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#xml/playerwidgetprovider" />
</receiver>
<service android:name=".widget.PlayerWidgetActivity$UpdateService" />
<service android:name=".widget.PlayerWidgetActivity$ServiceBindUnbindService" />
</application>
EDIT: My application is quite big (.APK ~ 10MB), of course it has many activity, many services, many broadcast receivers, ..... so it takes times to build.
I create a new very small application with just an activity and put the code for widget like i put on the big app above. It works! OMG! Why it worked on that small app but not my big app :(
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:label="#string/app_name"
android:name=".activity.ApplicationWithWidgetActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".widget.PlayerWidgetActivity"
android:icon="#drawable/ic_launcher"
android:label="#string/appwidget_name">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#xml/playerwidgetprovider" />
</receiver>
<service android:name=".widget.PlayerWidgetActivity$UpdateService" />
<service android:name=".widget.PlayerWidgetActivity$ServiceBindUnbindService" />
</application>
I've had same problem!
The solution is - INSTALLING APPLICATION INTO PHONE.
Just move application to phone and you will see your widget.
Hope it helps you!
Info from here: http://www.hrupin.com/2012/07/how-to-fix-android-homescreen-widget-installation-widget-as-part-of-android-application
Related
I have declared two services in my Android app, but neither of them is getting started when running my application. It doesn't show any type of error.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.simplifiedcoding.firebasecloudmessaging">
<!-- Adding Internet Permission -->
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
Defining Services
-->
<service
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name=".MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</application>
</manifest>
Have you tried these:
1) Include android:enabled="true" in your services tag as:
<service android:enabled="true" android:name=".MyFirebaseMessagingService" />
2) Start a Service with startService() method using onStartCommand() method.Click the hyperlinks for relevant information.
PS: Seems you've many Activities in your App and wants to start the Service in the MainActivity itself. Include your Java Classes code for those Services too. It will help users to help you better.
After Facebook Login connect, Run app in AndroidStudio, program execution is going with device, but the file will are not be visible. I do not know why this is the case happens.
I found a solution on the Internet. but I could not apply this solution in AndroidStudio here.
Has anyone experienced the same thing ? please tell me advice. thanks
have a problem with my AndroidManifest.xml file?
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebooktest.test.facebooktest">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
please read over your question ask i have no idea what your talking about , and why am seeing your manifest if your issue file not found
If its about building apk
goto the build menu click build apk , it the same menu used to rebuild app -- clean app
I'm attempting to use a campaign to promote my application. I've found these instructions and am attempting to do step one:
https://developers.google.com/analytics/devguides/collection/android/v2/campaigns#google-play-campaigns
However, my IDE (IntelliJ) is telling me it cannot resolve "com.google.analytics.tracking.android.CampaignTrackingService" in the Manifest file.
Is this a Bug in the IDE? Or is there a library I'm meant to be including with my application? And are there any other steps they have missed out? E.g. do I need to be adding internet permissions to my application?
When I run the application it seems to work fine, and here is my Android Manifest file:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17" />
<application
android:icon="#drawable/ic_launcher_toddlerswords"
android:label="#string/app_name"
android:hardwareAccelerated="true">
<activity android:name="maddy.toddlercolors.ToddlerWords"
android:screenOrientation="landscape"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="maddy.toddlercolors.menu.QuickPrefsActivity" android:label="#string/app_name"/>
<!-- Used for install referral measurement-->
<service android:name="com.google.analytics.tracking.android.CampaignTrackingService"/>
<receiver android:name="com.google.analytics.tracking.android.CampaignTrackingReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
</application>
After some further reading it looks like campaign tracking requires a google analytics jar, and will require internet permissions.
https://developers.google.com/analytics/devguides/collection/android/v2/
I can install my app on:
emulators 2.2, 2.3.3;
my phone 2.2.2;
And it's shown in launcher and widgets manager.
But after installing it on emulator 4.0.3, it is not shown in launcher and widgets manager.
Here is manifest:
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoDisplay" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".handlers.MyWidgetProvider" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/my_widget_info" />
</receiver>
</application>
Would you help me?
Thanks,
Edited:
This is such a stupid question. I tried to scroll the app list vertically. But in 4.0.3, the list is horizontal.
:-)
So there is no problem with my app. I'm sorry...
Your app widget will not show up in the widgets list until the user runs one of your activities. This behavior is new to Android 3.1.
There is nothing obviously wrong with the activity, though you might try removing Theme.NoDisplay and see if the behavior changes.
I'm currently working on a libproject (Android) that should be included inside a few other applications.
Everything is working fine now that I've been struggling a bit with Activities and Manifests, exept for the C2DM bit.
I can invoke my different classes fine, but I can't seem to catch the registration ID (or of course actual messages, but that must be the same problem...)
I think the problem is coming from the filtering in my manifest(s), so if anyone has any advice for me, that would be really helpful.
Here is a copy of receiver part of my manifest (from the apps, not the library, but it's actually just a copy), but it's pretty straighforward. I just want to know how I should adapt it in order to invoke the right class in the lib...
<!--
Only C2DM servers can send messages for the app. If permission is
not set - any other app can generate it
-->
<receiver
android:name="com.google.android.c2dm.C2DMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<!-- Receive the actual message -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.myapp.lib" />
</intent-filter>
<!-- Receive the registration id -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.myapp.lib" />
</intent-filter>
</receiver>
Where com.myapp.lib is my lib package name, and the receiver is in a package named the same (in the lib project, of course).
Thanks in advance for the help, and don't hesitate to ask for furthers details :)
Edit :
I tried with only the lib registered on google C2DM, and also with both app and lib. Same problem
There is a better way of using your C2DM from a library project by using the intent-filter.
The manifest file is the one from the app.
The package for the lib is com.mylib and the one for the app is com.myapp.
There is 2 things to change from the lib manifest.
The classpath used in permissions.
The intent-filter package.
Both should be you app package and not your lib package.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<permission android:name="com.myapp.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.myapp.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<application
android:icon="#drawable/icon"
android:label="#string/app_name" >
<uses-library android:name="com.google.android.maps" android:required="true"/>
<activity
android:name=".MyActivity"
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.mylib.C2DMRegistrationReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" >
</action>
<category android:name="com.myapp" />
</intent-filter>
</receiver>
<receiver
android:name="com.mylib.C2DMMessageReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" >
</action>
<category android:name="com.myapp" />
</intent-filter>
</receiver>
</application>
</manifest>
Answer, is anyone stumble upon the same problem...
In the google.android.c2dm package, class C2DMBaseReceiver, method runIntentInService, change
String receiver = context.getPackageName() + ".C2DMReceiver"
with the fully qualified name.. and there you go :)
The manifest looks fine. In your package you should have a class called C2DMReceiver and it should extend C2DMBaseReceiver. This class and the overridden methods it contains are then called upon successful registration and when a message is received. I have written a very basic example of this that may be helpful for you to refer to here