User Tag List

Results 1 to 9 of 9

Thread: How used android SDK

  1. #1
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    pradeep's Avatar
    Join Date
    Dec 2013
    Location
    India
    Posts
    248
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    How used android SDK

    I download android sdk
    where I copy android SDK for developed new extension?
    any tutorial?
    plz help me.

  2. #2
    Clickteam Clickteam
    Simon's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2,642
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    Hi Pradeep,

    do you have experience programming in Java or C++ already?

  3. #3
    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator ProUnicode Add-on

    Join Date
    Jun 2011
    Posts
    628
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    In fact you don't need these SDK files. All what you need is in this template:

    CRunTemplate.java
    Code:
    /* Copyright (c) 1996-2013 Clickteam
     *
     * This source code is part of the Android exporter for Clickteam Multimedia Fusion 2.
     * 
     * Permission is hereby granted to any person obtaining a legal copy 
     * of Clickteam Multimedia Fusion 2 to use or modify this source code for 
     * debugging, optimizing, or customizing applications created with 
     * Clickteam Multimedia Fusion 2.  Any other use of this source code is prohibited.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
     * IN THE SOFTWARE.
     */
    
    package Extensions;
    
    import Actions.CActExtension;
    import Conditions.CCndExtension;
    import Expressions.CValue;
    import RunLoop.CCreateObjectInfo;
    import Services.CBinaryFile;
    
    
    
    public class CRunTemplate extends CRunExtension
    {
        public static final int CND_LAST = 0;
    
    
    
        @Override public int getNumberOfConditions()
        {
            return CND_LAST;
        }
    
        public boolean createRunObject(CBinaryFile file, CCreateObjectInfo cob, int version)
        {
           
    
            return true;
        }
    
        public void destroyRunObject(boolean bFast)
        {
        }
    
        public int handleRunObject()
        {
            return 0;
        }
    	
    		
    	@Override public void continueRunObject()
    	{
    	
    	}
    
        public boolean condition(int num, CCndExtension cnd)
        {
    	
          /*   switch (num)
            {
                case 0:
                    return true;
            }*/
    
            return false;
        }
       
        public void action(int num, CActExtension act)
        {
           /* switch (num)
            {
                case 0:
    
                 break;        
    
            }*/
        }
    
        public CValue expression(int num)
        {
            /*switch (num)
            {
                case 0:
                    return new CValue(0);
    
            }*/
    
            return new CValue(0);
        }
        
    }
    You can find examples in folder data/runtime/android all android extensions are open.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    SoftWarewolf's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    929
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    What if you need to add lines to other files, such as adding activities to AndroidManifest.xml?

  5. #5
    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator ProUnicode Add-on

    Join Date
    Jun 2011
    Posts
    628
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Then you need to do this in PrepareAndroidBuild function which is in the file edittime.cpp

    example:
    Code:
    // PrepareAndroidBuild
    void CALLBACK PrepareAndroidBuild(LPMV pMV, LPEDATA edPtr, LPCWSTR androidDirectoryPathname)
    {
    #if !defined(RUN_ONLY)
    
    
        // Load manifest file
        bool bModified = false;
        TCHAR manifestPathname[_MAX_PATH];
        GetAndroidManifestPathname(manifestPathname, androidDirectoryPathname);
        LPSTR pAndroidManifestData = ReadTextFile(manifestPathname);
        if ( pAndroidManifestData != NULL )
        {
            ////////////////////////////////////////////////////////////////
            //
            //    Permissionss
            //
            ////////////////////////////////////////////////////////////////
    
    
            // Find string
            if ( strstr(pAndroidManifestData, "android.permission.WAKE_LOCK") == NULL )
            {
                // <uses-permission android:name="android.permission.WAKE_LOCK"/>
                pAndroidManifestData = InsertString(pAndroidManifestData, "<application android:", "    <uses-permission android:name=\"android.permission.WAKE_LOCK\"/>\r\n");
                bModified = true;
            }
    
    
    
    
    
    
        
            
    
    
            ////////////////////////////////////////////////
            //
            // receivers and services inside the application
            //
            ////////////////////////////////////////////////
            
    
    
            //if ( strstr(pAndroidManifestData, "com.cootje.extensions.MyAlarmService") == NULL )
        //    {
                // <service android:name="com.cootje.extensions.MyAlarmService" android:enabled="true"
        //        pAndroidManifestData = InsertString(pAndroidManifestData, "</application", "    <service android:name=\"com.cootje.extensions.MyAlarmService\"\r\n");
        //        pAndroidManifestData = InsertString(pAndroidManifestData, "</application", "              android:enabled=\"true\"/>\r\n");
        //        bModified = true;
        //    }
        char * stemp = new char[47];
        strcpy(stemp,"<action android:name=\"");
        strcat(stemp,edPtr->szUniqueID);
        strcat(stemp,"\"/>\r\n");
    
    
            if ( strstr(pAndroidManifestData, "com.cootje.extensions.MyAlarmReceiver") == NULL )
            {
                
                pAndroidManifestData = InsertString(pAndroidManifestData, "</application", "    <receiver android:name=\"com.cootje.extensions.MyAlarmReceiver\" >\r\n");
                pAndroidManifestData = InsertString(pAndroidManifestData, "</application", "    <intent-filter>\r\n");
                pAndroidManifestData = InsertString(pAndroidManifestData, "</application", stemp);
                pAndroidManifestData = InsertString(pAndroidManifestData, "</application", "    </intent-filter>\r\n");
                pAndroidManifestData = InsertString(pAndroidManifestData, "</application", "              </receiver>\r\n");
                bModified = true;
            }
    
    
        delete [] stemp;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
                          
            if ( bModified )
                WriteTextFile(manifestPathname, pAndroidManifestData);
        }
    
    
    
    
        
    #endif // !defined(RUN_ONLY)
    }

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    SoftWarewolf's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    929
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Awesome, thank you!
    i am bit confused what is going on here:
    TCHAR manifestPathname[_MAX_PATH];
    GetAndroidManifestPathname(manifestPathname, androidDirectoryPathname);
    LPSTR pAndroidManifestData = ReadTextFile(manifestPathname);

    GetAndroidManifestPathname() must be some method defined elsewhere?

    i am thinking to modify the runtime .java file as well, might be a bit trickier.

  7. #7
    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator ProUnicode Add-on

    Join Date
    Jun 2011
    Posts
    628
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Here is what you need
    Code:
    void GetAndroidManifestPathname(LPTSTR destPathname, LPCWSTR androidDirectoryPathname){
    #ifdef _UNICODE
    	_tcscpy_s(destPathname, _MAX_PATH, androidDirectoryPathname);
    #else
    	WideCharToMultiByte(CP_ACP, 0, androidDirectoryPathname, -1, destPathname, _MAX_PATH, NULL, NULL);
    #endif
    	int lg = _tcslen(destPathname);
    	if ( lg == 0 )
    		return;
    	if ( destPathname[lg-1] != '\\' )
    		_tcscat(destPathname, _T("\\"));
    	_tcscat(destPathname, _T("AndroidManifest.xml"));
    }
    
    
    void GetProjectPropertiesPathname(LPTSTR destPathname, LPCWSTR androidDirectoryPathname)
    {
    #ifdef _UNICODE
    	_tcscpy_s(destPathname, _MAX_PATH, androidDirectoryPathname);
    #else
    	WideCharToMultiByte(CP_ACP, 0, androidDirectoryPathname, -1, destPathname, _MAX_PATH, NULL, NULL);
    #endif
    	int lg = _tcslen(destPathname);
    	if ( lg == 0 )
    		return;
    	if ( destPathname[lg-1] != '\\' )
    		_tcscat(destPathname, _T("\\"));
    	_tcscat(destPathname, _T("project.properties"));
    }
    
    
    LPSTR ReadTextFile(LPCTSTR destPathname)
    {
    	LPSTR pData = NULL;
    	FILE* f = _tfopen(destPathname, _T("r"));
    	if ( f != NULL )
    	{
    		fseek(f, 0, SEEK_END);
    		long byte_length = ftell(f);
    		pData = (LPSTR)calloc(byte_length+1, sizeof(char));
    		if ( byte_length != 0 && pData != NULL )
    		{
    			fseek(f, 0, SEEK_SET);
    			fread(pData, byte_length, 1, f);
    			pData[byte_length] = 0;
    		}
    		fclose(f);
    	}
    	return pData;
    }
    
    
    void WriteTextFile(LPCTSTR destPathname, LPSTR pData)
    {
    	FILE* f = _tfopen(destPathname, _T("w"));
    	if ( f != NULL )
    	{
    		UINT bsize = strlen(pData) * sizeof(char);
    		if ( bsize != 0 )
    			fwrite(pData, bsize, 1, f);
    		fclose(f);
    	}
    }
    
    
    LPSTR InsertString(LPSTR pData, LPCSTR pStringToFind, LPCSTR pStringToInsert)
    {
    	LPCSTR pFoundStr = strstr(pData, pStringToFind);
    	if ( pFoundStr == NULL )
    		return pData;
    
    
    	int newsize = strlen(pData) + strlen(pStringToInsert);
    	LPSTR pNewData = (LPSTR)calloc(newsize+1, sizeof(char));
    	if ( pNewData == NULL )
    		return pData;
    	int lgBeginning = (int)(pFoundStr - pData);
    	memcpy(pNewData, pData, lgBeginning);
    	strcpy(pNewData + lgBeginning, pStringToInsert);
    	strcat(pNewData, pFoundStr);
    	free(pData);
    	return pNewData;
    }
    
    
    LPSTR AppendString(LPSTR pData, LPCSTR pStringToAdd)
    {
    	int newsize = strlen(pData) + strlen(pStringToAdd);
    	LPSTR pNewData = (LPSTR)calloc(newsize+1, sizeof(char));
    	if ( pNewData == NULL )
    		return pData;
    
    
    	memcpy(pNewData, pData, strlen(pData));
    	strcat(pNewData, pStringToAdd);
    	free(pData);
    	return pNewData;
    }

  8. #8
    Clicker

    Join Date
    Dec 2018
    Location
    北京
    Posts
    16
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I pasted all of your code.
    but I dont know :how to trigger the methor of " PrepareAndroidBuild " ?
    I don't find any where this method is called. so how to trigger this method? is it auto triggered?
    thanks a lot.

  9. #9
    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator ProUnicode Add-on

    Join Date
    Jun 2011
    Posts
    628
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It is called by the CF before compiling an android project.

Similar Threads

  1. Replies: 56
    Last Post: 26th December 2017, 08:53 PM
  2. Android Exporter - Trouble Building an Android Application
    By Appsareawesome in forum Android Export Module Version 2.0
    Replies: 1
    Last Post: 19th February 2014, 06:48 PM
  3. Setting up the Android SDK for the Android Export Module
    By Jeff in forum Android Export Module 2.5
    Replies: 3
    Last Post: 2nd October 2013, 04:08 PM
  4. Need Android Class Name and Android Package Name to create my facebook ads
    By paobrasil in forum Android Export Module Version 2.0
    Replies: 8
    Last Post: 17th April 2013, 04:49 PM
  5. [Building Error] Android Dialogs & Android Lights
    By ProdigyX in forum Android Export Module Version 2.0
    Replies: 2
    Last Post: 20th March 2013, 10:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •