Android Widget post-Install Problem! - android

my widget is full and ready to work, after i install it i can't find in the emulator widgets list .. although it's there when i search for it in the installed applications .. i think it's a problem in the manifest, here is the manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="help.i.bored.bad" android:versionCode="1" android:versionName="1.2">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application android:icon="#drawable/icon" android:label="#string/app_name">
<!-- Broadcast Receiver that will process AppWidget updates -->
<receiver android:name=".HitsWidget" android:label="#string/app_name">
<intent-filter>
<action android:name="help.i.bored.bad.HitsWidge.receiver1" />
<action android:name="help.i.bored.bad.HitsWidge.receiver2" />
<action android:name="help.i.bored.bad.HitsWidge.receiver3" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#xml/hitswidge_provider" />
</receiver>
<Service android:name=".MediaService">
<intent-filter>
<action android:name="help.i.bored.bad.HitsWidge.receiver2" />
<action android:name="help.i.bored.bad.HitsWidge.receiver1" />
</intent-filter>
</Service>
<Activity android:name=".Stations" android:label="#string/app_name">
<intent-filter>
<action android:name="help.i.bored.bad.HitsWidge.receiver3" />
</intent-filter>
</Activity>
</application>

Your Broadcast receiver doesn't listen for the android.appwidget.action.APPWIDGET_UPDATE action. This is all covered in:
AppWidgets

Related

Service in binded Jar doesn't come up without "RECEIVE_BOOT_COMPLETED"

I have an App that uses a Service that I've added by a Bindable Jar.
Current state:
this Jar has an own Manifest (see below), when I don't touch anything on this Manifest everything works as it should.
Problem:
This Jar lets on Deployment to Device always its launer AppIcon on Device.
So my App leaves finaly two launcher icons, the one desired and the other from the Jar.
My Approach was to delete follow Part from Manifest:
android:theme="#style/AppTheme">
<activity
android:name=".ScanDemoActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Doing this the App Crashed on BootUp with Error: BootReceiver not found ...
Deleting the next few Lines:
<receiver android:name="com.company.scandemo.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<category android:name="android.intent.category.HOME"/>
</intent-filter>
</receiver>
caused started correctly on bootUp, but the Service didn't come up on BOOT_COMPLETED, when I start the App via Launcher icon everything worked.
Wished Behaviour:
I want the Main App to leave only one launch Icon and startup correctly on Boot
Here is the Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.company.scandemo"
android:versionCode="1"
android:versionName="2.2" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".ScanDemoActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.company.scandemo.FloatingService" />
<receiver android:name="com.company.scandemo.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<category android:name="android.intent.category.HOME"/>
</intent-filter>
</receiver>
</application>
</manifest>

Android Broadcast Receiver not Working (Boot Complete)

I want to start BroadcastReceiever on installation of my application. I found some Thread over stackoverflow that this could be done by using Boot Complete BroadCastReceiever.
But After writing code we could not get success because my receiver did not call at all.
Manifest File:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.broadcastdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<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" >
<activity
android:name="com.example.broadcastdemo.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.example.broadcastdemo.BootReceiver"
android:enabled="true"
android:exported="false"
>`
`
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>
Did you register the receiver in manifest.xml
<receiver
android:name="YOUR_ACTION_STRING.BootCompletedReceiver"
android:enabled="true"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

Widget not appearing on app list

I created an widget and it is not showing on the widget list, but when I go to Settings->Application Manager, the widget IS on the app list. I was debugging it and it was working like a charm before, but it disappeared suddenly. I assume it has to do with my manifest. If you need the rest of the code, I can put it on my dropbox.
I am currently running 4.1.1 and my log states there isn't any issues... help :/
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ps.transparenttogglewidget"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<!-- AIRPLANE MODE CODE -->
<receiver android:name="AirplaneModeWidget" >
<intent-filter>
<action android:name="android.appwidget.action.AIRPLANE_WIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/airplane_mode_provider" />
</receiver>
<receiver
android:name="AirplaneModeIntentReceiver"
android:label="AirplaneModeBroadcastReceiver" >
<intent-filter>
<action android:name="com.ps.transparenttogglewidget.intent.action.AIRPLANEMODE_CHANGE_STATUS" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/airplane_mode_provider" />
</receiver>
<receiver android:name="AirplaneModeReceiver">
<intent-filter>
<action android:name="android.intent.action.AIRPLANE_MODE">
</action>
</intent-filter>
</receiver>
<!-- WIFI MODE CODE -->
<receiver android:name="WifiModeWidget" >
<intent-filter>
<action android:name="android.appwidget.action.WIFI_WIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/wifi_provider" />
</receiver>
<receiver
android:name="WifiModeIntentReceiver"
android:label="WifiModeBroadcastReceiver" >
<intent-filter>
<action android:name="com.ps.transparenttogglewidget.intent.action.WIFI_MODE_CHANGE_STATUS" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/wifi_provider" />
</receiver>
<receiver android:name="WifiModeReceiver">
<intent-filter>
<action android:name="android.intent.action.WIFI_MODE">
</action>
</intent-filter>
</receiver>
</application>
</manifest>

can broadcast receveir work even when my app is closed

I am building a simple sms app , i want to open my app automaticaly when ever a new sms is received? is it even possible?
i am using broadcast receiver for this
what changes should i made in manifest?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.message"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".MessageActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<receiver android:name=".SmsReceiver" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</activity>
<activity android:name=".Reply" >
</activity>
</application>
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
</manifest>
you should move the receiver outside from the activity like this:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".MessageActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Reply" >
</activity>
<receiver android:name=".SmsReceiver" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
Under Android 3.0 and later, your broadcast is not guaranteed to be received unless the user has opened your application. The application does not have to remain opened, just to have been started once. This is caused by a flag (FLAG_EXCLUDE_STOPPED_PACKAGES) which is now part of most system broadcasts, which says the broadcast should not start a stopped application.
This was already answered in How to make android launch an application on received specific sms to keep it short: it is possible with BroadcastReceiver.

How to put widget and app in same apk?

I'm trying to put a widget and an app in the same apk.
Here's my manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.me.mywidget"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".settingsPage"
android:label="#string/app_name"
android:theme="#style/app_theme"
>
<intent-filter>
<action android:name="com.me.mywidget.SETTINGSPAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="MyWidgetProvider" android:label="My Widgets">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#layout/widget_info" />
</receiver>
<service android:name=".UpdateWidgetService"></service>
<activity android:name=".Test"></activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="7" />
</manifest>
How do I put an app and market in the same apk? I tried this and while it runs, the app does not show up in the app drawer.
Also, when I add android:name=".mywidgets" my widget crashes when I run it.
Also, I will be adding multiple sizes to the widget later on.
You need to add the intent filter for launcher to whichever activity you want to show in the launcher...
<category android:name="android.intent.category.LAUNCHER" />
So if .Test is your primary launching activity you would modify your manifest like below..
<activity android:name=".Test"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Categories

Resources