Amazing Tutorials for Android Developers...

Friday, June 14, 2013

StartAppDemo

StartApp Advertisement tutoril for android applications.


Simple Demo that show how the StartApp SDK works.

We have found a new way to generate some money from this free app. using this new search tool, we can keep creating apps and give them to you completely free forever!  

This search is from our search partner and give you access to great web search via a search icon, bookmark link and homepage. You may remove them at your choice.



 Have you found a strange search icon on your home screen?
 Have you found a strange browser search home page?
 Have you found a strange bookmark links?

 Don't worry, it's nothing dangerous. This application tells you what is StartApp and how it works.






you use following code for that class.



.JAVA code
================================================================

private HtmlAd htmlAd = null;
    Button btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        btn = (Button) findViewById(R.id.button1);
       
        AndroidSDKProvider.setTestMode(true);
        AndroidSDKProvider.initSDK(MainActivity.this);
        AdPreferences adPreferences = new AdPreferences("112311471","206506517",AdPreferences.TYPE_INAPP_EXIT);
        htmlAd = new HtmlAd(this);
        htmlAd.load(adPreferences, this);
       
        btn.setOnClickListener(new OnClickListener() {
           
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                if(htmlAd != null) {
                    htmlAd.show();
                }
            }
        });
    }

   
    @Override
    public void onBackPressed() {
        // TODO Auto-generated method stub
   
        if(htmlAd != null) {
            htmlAd.show();
        }
       
        super.onBackPressed();
    }


    @Override
    public void onFailedToReceiveAd(Ad arg0) {
        // TODO Auto-generated method stub
       
    }

    @Override
    public void onReceiveAd(Ad arg0) {
        // TODO Auto-generated method stub
       
    }
   
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

 

================================================================



This type of popup you show.


.XML code
================================================================


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="Go Back for Add or Click on Button" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView1"
        android:layout_centerHorizontal="true"
        android:text="Show Start App Add." />

</RelativeLayout>


================================================================


Also it required more user-permissions in their manifest file.

There is a following code put into manifest file for give permissions.


Manifest.xml
================================================================ 


<uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
    <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
    <uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
    <uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS" />
    <uses-permission android:name="com.motorola.launcher.permission.READ_SETTINGS" />
    <uses-permission android:name="com.motorola.dlauncher.permission.READ_SETTINGS" />
    <uses-permission android:name="com.fede.launcher.permission.READ_SETTINGS" />
    <uses-permission android:name="com.lge.launcher.permission.READ_SETTINGS" />
    <uses-permission android:name="org.adw.launcher.permission.READ_SETTINGS" />
    <uses-permission android:name="com.motorola.launcher.permission.INSTALL_SHORTCUT" />
    <uses-permission android:name="com.motorola.dlauncher.permission.INSTALL_SHORTCUT" />
    <uses-permission android:name="com.lge.launcher.permission.INSTALL_SHORTCUT" />
    <uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS" />
    <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
    <uses-permission android:name="com.android.launcher.permission.WRITE_SETTINGS" />
    <uses-permission android:name="com.htc.launcher.permission.WRITE_SETTINGS" />
    <uses-permission android:name="com.motorola.launcher.permission.WRITE_SETTINGS" />
    <uses-permission android:name="com.motorola.dlauncher.permission.WRITE_SETTINGS" />
    <uses-permission android:name="com.lge.launcher.permission.WRITE_SETTINGS" />
    <uses-permission android:name="com.fede.launcher.permission.WRITE_SETTINGS" />
    <uses-permission android:name="org.adw.launcher.permission.WRITE_SETTINGS" />



<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.startappdemo.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>

        <service
            android:name="com.apperhand.device.android.AndroidSDKProvider"
            android:enabled="true" />

        <activity
            android:name="com.apperhand.device.android.EULAActivity"
            android:configChanges="keyboard|keyboardHidden|orientation"
            android:theme="@android:style/Theme.Translucent" />
        <activity
            android:name="com.startapp.android.publish.AppWallActivity"
            android:configChanges="orientation|keyboardHidden"
            android:theme="@android:style/Theme.Translucent" />
       
       
        <meta-data android:name="com.startapp.android.DEV_ID" android:value= "DEV_ID_HERE"/>
        <meta-data android:name="com.startapp.android.APP_ID" android:value= "APP_ID_HERE"/>
       
    </application>
 
================================================================ 

 

For more information you click here.

For Source Code Download Click here.


1 comment:

Animation Tutorial

Animation Image Used in Android Tutorial GIF Image used in Android Application. for that you need to use following code implementation...