Android Dictionary not working - android

I wrote my own dictionary definition words in my dictionary application. But whenever i launching my dictionary application in my emulator default android dictionary working won't working my app dictionary. I changed all the provider permission,manifest file all those things. But dictionary not working.
Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.searchbook"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/ic_dictionary"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<!-- The default activity of the app; displays search results. -->
<activity android:name=".SearchBook"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Receives the search request. -->
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<!-- No category needed, because the Intent will specify this class component-->
</intent-filter>
<!-- Points to searchable meta data. -->
<meta-data android:name="android.app.searchable"
android:resource="#xml/searchable" />
</activity>
<!-- Displays the definition of a word. -->
<activity android:name=".WordActivity" />
<!-- Provides search suggestions for words and their definitions. -->
<provider android:name=".DictionaryProvider"
android:authorities="com.example.searchbook.DictionaryProvider" />
<!-- Points to searchable activity so the whole app can invoke search. -->
<meta-data android:name="android.app.default_searchable"
android:value=".SearchBook" />
</application>
</manifest>

"com.example.searchbook" seems like convention of android for sample apps. There may be an existing app named exactly like that. As you pointed out it launches the default. Try to refactor it to something else like "com.stackoverflow.karthi".

Related

Android contacts - custom field icon not showing in android 6

The goal
I'm working on application that keeps own contacts in contacts database. I want to add my own field with my logo that leads to my application's edit form.
What I did already
Working with this tutorial: http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-2/
and a couple of other sources i have assembled something like this:
AndroidMainifest.xml:
<service android:enabled="true" android:exported="true" android:name="com.MySyncAdapterService" android:process=":contacts">
<intent-filter android:icon="#drawable/icon">
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data android:name="android.provider.CONTACTS_STRUCTURE" android:resource="#xml/contacts" />
<meta-data android:name="android.content.SyncAdapter" android:resource="#xml/sync_contacts" />
</service>
Contacts.xml:
<ContactsAccountType xmlns:android="http://schemas.android.com/apk/res/android">
<ContactsDataKind
android:icon="#drawable/icon"
android:smallIcon="#drawable/icon"
android:mimeType="vnd.android.cursor.item/vnd.my.contact"
android:summaryColumn="data2"
android:detailColumn="data3"
android:detailSocialSummary="true" >
</ContactsDataKind>
</ContactsAccountType>
The problem
As can be seen on first image my custom field is displayed with icon properly in Android 4.3. Unfortunatetly Android 6.0.1 does display my field but without the icon.
Any help will be appreciated, I'm running out of hair on my head ;)
I think i resolved my problem. Android 6.0 seems to ignore ContactsDataKind icon property. In order to provide icon for custom field you need to provide action hadndling it. It will use intent filter's icon if it's provided. If not it will use your application's icon.
<activity android:name=".ContactActivity">
<intent-filter android:icon="#drawable/icon">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.my.contact" />
</intent-filter>
</activity>

Android : what category of intent filter should i use

In the second and third activity, in the intent filter what should i use in category.In the second activity i used default but after making third activity i do not know what category should i use.
This is the first android app i am trying to make.Please help me,which categoty should i use in second and third activity.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="csimplifyit.mobileapp.myschool">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<!-- for json call -->
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/login"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".login.Login"
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=".login.Menu"
android:label="#string/second_activity">
<intent-filter>
<action android:name="csimplifyit.mobileapp.myschool.login.Menu" />
<category android:name="android.intent.category. " />
</intent-filter>
</activity>
<activity
android:name=".login.Attendance"
android:label="#string/attendance_activity">
<intent-filter>
<action android:name="csimplifyit.mobileapp.myschool.login.Attendance" />
<category android:name="android.intent.category. " />
</intent-filter>
</activity>
</application>
Most likely, you get rid of the second and third <intent-filter> elements entirely. Only have <intent-filter> elements on activities that you expect other apps to link to. You do not need action strings for starting your own activities -- you can use explicit Intents (e.g., new Intent(this, csimplifyit.mobileapp.myschool.login.Menu.class)).
If, for some reason, you are expecting other developers to directly start your Menu or Attendance activities, then the simplest thing is to put them in the DEFAULT category as well. A call to startActivity() automatically adds the DEFAULT category to the Intent, if the Intent has not specified another category.

Launching app from HomeScreen (shortcut) and from App drawer, is not the same

I've encountered a weird behaviour. Maybe someone could clarify it.
When I download my app from GooglePlay, there are 2 icons that are added. One goes to the Home Screen as a shortcut and another goes to the App Drawer (the screen with all the different installed apps I got on my device).
Now here is the flow of events:
I install the app from GooglePlay
I launch the app once installation is complete, also from GooglePlay (There's an open button) --> This launches the app, shows a splash screen and goes to my main screen
I navigate around in my app to a different screen
I click the home button to go to the Home Screen.
Now the interesting part:
I press the Home Screen shortcut icon GooglePlay has created for me to get back to my app --> This takes me to the exact same screen I was in.
I click the home button again to go to the Home Screen.
This time, I press the App Drawer shortcut icon to get back to my app --> This shows the splash screen again and takes me to my main screen.
This happens constantly. Each shortcut launches to a different state (or screen).
Notice that there is only one app in the Recent list.
On a the other hand. If I create the Home Screen shortcut myself, I get the same results when I launch the app from both icons.
Something is different with the shortcut GooglePlay is creating for me.
Any ideas?
EDIT
Here is the AndroidManifest.xml
Some names where changed. Some information (that is not related to intent-filters) had to be removed..
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.xxxx.xxxxjh"
android:installLocation="internalOnly">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
tools:node="replace"
android:name=".xxxxgggApplication"
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:largeHeap="true"
android:hardwareAccelerated="true"
android:theme="#style/AppTheme" >
<activity
android:name=".view.activities.StartupActivity"
android:theme="#style/AppThemeNoBar"
android:windojhoftInputMode="adjustResize|stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".view.activities.WelcomeActivity"
android:theme="#style/WelcomeActivityStyle"/>
<activity
android:name=".view.activities.AccountActivity"
android:theme="#style/AppThemeNoBar"
android:windojhoftInputMode="adjustResize|stateHidden"/>
<activity
android:name=".view.activities.UrlSchemeHandlerActivity"
android:launchMode="singleInstance">
<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:scheme="xxxx" />
</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:scheme="xxxx5.4" />
</intent-filter>
</activity>
<activity
android:name=".view.activities.FileManagerActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:logo="#drawable/fm_drawer"
android:theme="#style/AppThemeBar"
android:windojhoftInputMode="adjustPan|stateHidden"/>
<activity
android:name=".view.activities.ViewerActivity"
android:label="#string/launcher_activity_label"
android:theme="#style/AppThemeNoBar"
android:windojhoftInputMode="adjustResize|stateHidden"
android:parentActivityName=".view.activities.FileManagerActivity" >
<!-- The meta-data element is needed for versions lower than 4.1 -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".view.activities.FileManagerActivity" />
</activity>
<activity
android:name=".view.activities.DemoActivity"
android:label="#string/launcher_activity_label"
android:theme="#style/WelcomeActivityStyle"
android:windojhoftInputMode="adjustResize|stateHidden" />
<activity
android:name=".view.activities.ApplicationSettingsActivity"
android:logo="#drawable/fm_drawer"
android:label="#string/AG_Settings"
android:windojhoftInputMode="adjustResize|stateHidden">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xxxx.xxxxjh.view.activities.FileManagerActivity" />
</activity>
<activity
android:name=".view.activities.WebViewActivity"
android:logo="#drawable/fm_drawer"
android:theme="#style/AppThemeBar" />
<service android:name="com.xxxx.sdk.controller.service.account.AccountService" >
<!-- Actions and meta data goes here... -->
</service>
<service android:name="com.xxxx.sdk.controller.service.storage.StorageService">
<!-- Actions and meta data goes here... -->
</service>
<service android:name="com.xxxx.sdk.controller.service.designFeed.DesignFeedService">
<!-- Actions and meta data goes here... -->
</service>
<service android:name="com.xxxx.sdk.controller.service.ConfigService">
<!-- Actions and meta data goes here... -->
</service>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
I am sorry to tell you that this is not a bug in your project but an android default behaviour. I did some research ending up in the following threads. Maybe you can filter out some useful information and test these approaches in your project.
App completely restarting when launched by icon press in launcher
Android application restarts when opened by clicking the application icon
Greetz.

Android manifest for USBAccesory

I am making an app that communicates with a piece of usb hardware made by my company (this is the only app allowed to talk to the usb accessory, it's not a public api). I am having difficulties setting up the proper launch modes in the manifest.
There are three components to the app: the main activity, a login activity, and the USBService.
I'm assuming the intent for the main goes to the login activity, and the intent for the usb goes to the USBService, but I am not sure if I do this, will this start the service if the app is not running? More over, if it does, how do I fetch an already existing service?
What type of structure should I be looking at for the manifest file? (specifically, intent-filters, and appropriate launch modes... I've read a few documents about the launch modes but I am still not sure I quite understand... There should only ever be at most one instance of each activity/service, and they need to communicate together.
edit: it is not necessary for communications to start before the app is open, nor is it necessary to launch the app automatically when the usb is connected.
edit: my manifest as it stands, looks like:
<uses-feature android:name="android.hardware.usb.accessory" />
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name="mainpackage.MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="#xml/accessory_filter" />
</activity>
<activity
android:name="mainpackage.LoginActivity"
android:label="#string/title_activity_login"
android:windowSoftInputMode="adjustResize|stateVisible" >
</activity>
<service android:name="updater.USBService"
android:exported="false" >
<!--
-->
</service>
</application>
in your manifest add
<manifest ...>
<uses-feature android:name="android.hardware.usb.host" />
<uses-sdk android:minSdkVersion="12" />
In this case, the following resource file should be saved in res/xml/device_filter.xml and specifies that any USB device with the specified attributes should be filtered:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<usb-device vendor-id="1234" product-id="5678" class="255" subclass="66" protocol="1" />
</resources>
Hope this help.
Your manifest looks good,
I think you make a good choice for putting the intent-filter "android.hardware.usb.action.USB_ACCESSORY_ATTACHED" in the mainActivity and start the application in this activity,
and again I think it's a good choice to start your mainActivity in SingleTop launch mode,
because if an instance of the mainActivity already exists at the top of the current task, the system going to launch this activity, no new instance of this activity will be created.
For a best understanding of the different launch mode available in android,
I think this link may help you :
http://www.intridea.com/blog/2011/6/16/android-understanding-activity-launchmode
To make a long story short I think you'll be all set with this manifest as is.
To Use Android Devices min SDK version should be set to 12 and need to declare following line in AndroidManifest.xml file
<>
<uses-sdk android:minSdkVersion="<version>" />
...
<application>
<uses-library android:name="com.android.future.usb.accessory" />
<activity ...>
...
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="#xml/accessory_filter" />
</activity>
</application>

Finding the "Android class name" in "AndroidManifest.xml" generated by Unity3D

When configuring a "Android Native App" in a Facebook app, they require the Android Class Name. If you created the Android APK from Unity3D, how do you know what class to use?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="--------------" android:versionName="1.02" android:versionCode="8">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<application android:icon="#drawable/app_icon" android:label="#string/app_name" android:debuggable="true">
<activity android:name="com.unity3d.player.UnityPlayerProxyActivity" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="landscape">
</activity>
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="landscape">
<meta-data android:name="android.app.lib_name" android:value="unity" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
</activity>
<activity android:name="com.unity3d.player.VideoPlayer" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="landscape">
</activity>
<!-- ACTIVITIES -->
<activity android:name="com.prime31.FacebookProxyActivity" />
<!-- META-DATA -->
</application>
<!-- PERMISSIONS -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:glEsVersion="0x00020000" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.sensor.accelerometer" />
<uses-feature android:name="android.hardware.touchscreen" />
<uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" />
</manifest>
This field should be your main activity (associated with MAIN and LAUNCHER). In this case, I think it would be com.unity3d.player.UnityPlayerProxyActivity.
This is mainly necessary if you use native deep links (so the FB app can create an intent that directly calls your activity). In that respect, any publicly accessible Activity in your app will do.
The main activity's tag should contain an intent-filter tag with the action android.intent.action.MAIN and the category android.intent.category.LAUNCHER.
Description of the intent-filter tag (from documentation):
Specifies the types of intents that an activity, service, or broadcast
receiver can respond to. An intent filter declares the capabilities of
its parent component — what an activity or service can do and what
types of broadcasts a receiver can handle. It opens the component to
receiving intents of the advertised type, while filtering out those
that are not meaningful for the component. Most of the contents of the
filter are described by its <action>, <category>, and <data>
subelements.
For a more detailed discussion of filters, see the separate Intents
and Intent Filters document, as well as the Intents Filters section in
the introduction.
The main activity of an Android application has an intent-filter with the category LAUNCHER which basically tells that the activity can "launch the app" (in other words, that it is the launcher/entry).
The activity tag should look something like this:
<activity android:name="ActivityClassName" android:label="Activity title">
<!-- The intent filter -->
<intent-filter>
<!-- The action -->
<action android:name="android.intent.action.MAIN"/>
<!-- The category -->
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
By looking at your AndroidManifest.xml, you can conclude that the main Activity of your app is the com.unity3d.player.UnityPlayerProxyActivity Activity, because it contains an intent-filter matching those criterias.
Good luck with your game!
Using "UnityPlayerProxyActivity" is no longer true for all unity versions. You may have to use "UnityPlayerActivity" instead.
Details:
If you export an Android project from unity you may find three classes in src:
UnityPlayerActivity
UnityPlayerNativeActivity
UnityPlayerProxyActivity
"UnityPlayerProxyActivity" and "UnityPlayerNativeActivity" have been deprecated since Unity 5.0 beta12, thus you have to use "UnityPlayerActivity" instead.
In Facebook type in:
[tld.yourdomain.game].UnityPlayerActivity
Replace the [...] part with your app specifics of course. Attention: If you have some plugins/extensions that fiddle around with your manifest, then this may be different.
UPDATE:
In newer Versions of the Facebook SDK for Unity (tested with 7.9.4) you can simply search for "FacebookSettings" in your Assets folder and it will tell you what Class Name to use ("com.facebook.unity.FBUnityDeepLinkingActivity" for example).

Categories

Resources